package com.zookeeper.te2;

import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;

import java.io.IOException;

/**
 * 作者: LCG
 * 日期: 2019/9/17 11:18
 * 描述:
 */
public class MyTest0001 {

    public static void main(String[] args) throws IOException, KeeperException, InterruptedException {

        ZooKeeper zooKeeper=new ZooKeeper("192.168.137.1",2181,null);

        //zooKeeper.create("/YYY","TEST,NODE".getBytes(),ZooDefs.Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT);

        //Stat stat=new Stat();
        //zooKeeper.getData("/YYY",true,null);
        //byte[] data = zooKeeper.getData("/YYY", true, stat);
        //System.out.println(new String(data));

        //zooKeeper.getData("/YYY",new MyWatcher02(),stat);

       // zooKeeper.setData("/YYY","UPDATE,DATA".getBytes(),stat.getVersion());

        zooKeeper.delete("/YYY/lock_",-1);

        //zooKeeper.exists()

        //zooKeeper.getChildren();

        zooKeeper.close();

    }

}
